package com.hk.webapp.controller.admin;

import com.hk.webapp.bean.SysRoleAction;
import com.hk.webapp.service.SysRoleActionService;
import com.hk.webapp.vo.ResultVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class SysRoleActionController extends AdminBaseController {

    @Resource
    private SysRoleActionService sysRoleActionService;

    @GetMapping("/SysRoleAction/GetActionByRoleId")
    public ResultVo GetActionByRoleId(Integer roleId){
        if (roleId<=0){
            return  ResultVo.createByError("非法参数");
        }
        List<SysRoleAction> list=sysRoleActionService.getEntityListByRoleId(roleId);

        return ResultVo.createBySuccessData(list.parallelStream().map(SysRoleAction::getSysActionId));
    }
}
